package com.heima.controller;

import com.heima.pojo.Task;
import com.heima.pojo.vo.TaskVo;
import com.heima.pojo.vo.TaskVoRe;
import com.heima.service.TaskService;
import com.heima.utils.PageResult;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 赵超
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/task-service/task")
public class TaskController {

    private final TaskService taskService;

    @GetMapping("/taskReportInfo/{start}/{end}")
    public List<TaskVoRe> getTaskList(
            @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @PathVariable LocalDateTime start,
            @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @PathVariable LocalDateTime end
    ) {
        List<TaskVoRe> list = new ArrayList<>();
        list.add(new TaskVoRe());
        return list;
    }


    @GetMapping("/search")
    public PageResult<TaskVo> list(
            Integer pageIndex,
            Integer pageSize,
            String isRepair
    ) {

        return taskService.list(pageIndex, pageSize, isRepair);
    }
}
